// 1. 导入 Vue 和 VueRouter 的包
import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '@/views/Login.vue'
import Index from '@/views/Index.vue'
import ProjectManagement from '@/components/ProjectManagement.vue'
import UserManagement from '@/components/UserManagement.vue'
import WorkerManagement from '@/components/WorkerManagement.vue'
import ProjectDetail from '@/views/ProjectDetail.vue'
import ProjectBaseInfo from '@/components/ProjectBaseInfo.vue'
import ProjectDuration from '@/components/ProjectDuration.vue'
import ProjectQuestion from '@/components/ProjectQuestion.vue'
import ProjectAnalysis from '@/components/ProjectAnalysis.vue'
import AdvanceList from '@/components/AdvanceList.vue'
import ClockInList from '@/components/ClockInList.vue'
import Print from "@/views/Print.vue";
import AuditAdvance from "@/components/AuditAdvance.vue";
import Expenses from '@/components/ProjectExpenses'
import Collection from '@/components/ProjectCollection'
import JobDetails from '@/components/JobDetails'

// 2. 调用 Vue.use() 函数，把 VueRouter 安装为 Vue 的插件
Vue.use(VueRouter)


// 3. 创建路由的实例对象
const router = new VueRouter({
  routes: [
    {path: "/",redirect: "/login"},
    {path: "/login",component: Login},
    {path: "/print",component: Print,name:'print'},
    {
      path: "/index",
      redirect: "/index/projectmange",
      component: Index,
      children: [
        {
          path: "projectmange",
          component: ProjectManagement
        },
        {
          path: "usermange",
          component: UserManagement
        },
        {
          path: "employeemange",
          component: WorkerManagement
        },
        {
          path: "advance-list",
          component: AdvanceList
        },
        {
          path: "audit-advance",
          component: AuditAdvance
        },
        {
          path: "clock-in-list",
          component: ClockInList
        },
        {
          path:'job-details',
          component:JobDetails
        }
      ]
    },
    {
      path: "/project/:id",
      redirect: "/project/:id/baseInfo",
      component: ProjectDetail,
      children: [
        {
          path: "baseInfo",
          component: ProjectBaseInfo
        },
        {
          path: "duration",
          component: ProjectDuration
        },
        {
          path: "question",
          component: ProjectQuestion
        },
        {
          path: "analyse",
          component: ProjectAnalysis
        },
        {
          path: "collection",
          component: Collection
        },
        {
          path: "expenses",
          component: Expenses
        },
        
        
      ]
    }
  ]
})


// 4. 向外共享路由的实例对象
export default router
